<%@ page language="java" import="java.sql.Statement,java.sql.ResultSet"
	pageEncoding="UTF-8"%>
<html>
<head>
<title>会员删除</title>
<link rel="stylesheet" href="css/wzys.css" />
</head>
<body>
	<%@ include file="../conn.jsp"%>
	<%	//得到记录集	
	if((String)session.getAttribute("admin")==null){  //防止非管理员未经登录而直接使用
		out.print("<script>alert('管理员登录后方可使用本功能！');location.href='index.jsp'</script>");
	}
	
	String sql;
	Statement stmt=conn.createStatement();
	String un=(String)request.getParameter("un"); //获取GET请求传参
	out.print(un);
	if(un!=null){
		sql="Delete from user where username='"+un+"'";
		//out.print(sql);
		stmt.executeUpdate(sql);  //操作查询——删除
	}
	sql="select * from user order by username asc";  //from是必须
	ResultSet rs =stmt.executeQuery(sql);  //选择查询
 %>
	<table border="1" width="500">
		<caption>
			<span class="title">会员信息显示及会员删除管理</span>
		</caption>
		<tr>
			<td>会员名称</td>
			<td>会员真名</td>
			<td>手机号</td>
			<td>年龄</td>
			<td>操作</td>
		</tr>
		<% while(rs.next()){%>
		<tr>
			<td><%=rs.getString("username") %></td>
			<td><%=rs.getString("realname") %></td>
			<td><%=rs.getString("mobile") %></td>
			<td><%=rs.getString("age") %></td>
			<td><a href="memDelete.jsp?un=<%=rs.getString("username")%>"
				onclick="return window.confirm('Are you sure?')">删除</a></td>
		</tr>
		<% } %>
<!-- 
<td><a href="memDelete.jsp?un=Sunman"onclick="return window.confirm('Are you sure?')">删除</a></td>

 -->
	</table>

</body>
</html>